package com.zzptc.zzsgz.bdsjws.fragments;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.zzptc.zzsgz.bdsjws.MyApplication;
import com.zzptc.zzsgz.bdsjws.R;
import com.zzptc.zzsgz.bdsjws.adapter.ContactAdapter;
import com.zzptc.zzsgz.bdsjws.fragments.base.BaseFragmentbase;
import com.zzptc.zzsgz.bdsjws.vo.Contact;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;



public class SelectContactFragment extends BaseFragmentbase {
    @BindView(R.id.rv_select_contact)
    RecyclerView rvSelectContact;
    List<Contact>contactsList=new ArrayList<Contact>();
    ContactAdapter contactAdapter;
    @Override
    public int getXML() {
        return R.layout.select_contact_fragment;
    }

    @Override
    public void initView() {
//        //项  适配器  都可以公用
//        List<Contact> anyList=new ArrayList<Contact>();
//        List<Contact> allList= MyApplication.getList();
//        //要知道输入框中输入了什么内容，再去匹配
//        for (int i=0;i<allList.size();i++){
//
//        }
//       // ContactAdapter contactAdapter=new ContactAdapter();
//        rvSelectContact.setLayoutManager(new LinearLayoutManager(getActivity()));
    }

    @Override
    public void initData() {
        rvSelectContact.setLayoutManager(new LinearLayoutManager(MyApplication.getContext()));
       // contactAdapter=new ContactAdapter(contactsList);
      //  rvSelectContact.setAdapter(contactAdapter);
    }
    public void getSelectContactList(List<Contact>contacts){
        contactsList.clear();

        contactsList.addAll(contacts);
        if (contactsList!=null) {
            contactAdapter.notifyDataSetChanged();
        }
    }
}
